package cn.bluedot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.bluedot.model.Backup;
import cn.bluedot.service.BackupAndRecoverService;

/**
 * 数据库备份和恢复
 * 
 * @author hxp 2019年4月18日 下午7:36:00
 */
@Controller
public class BackupAndRecoverController {
    @Autowired
    BackupAndRecoverService backupAndRecoverService;
    /**
     * 将单个表备份 并记录备份信息
     * @param backup
     */
    @RequestMapping("/backtable")
    public void simpleTableBackup(Backup backup) {
        backupAndRecoverService.simpleTableBackup(backup);
    }
    
    /**
     * 将整个数据库恢复 并记录恢复信息
     * @param backup
     */
    @RequestMapping("/recover")
    public void dataBaseRecover(String recoverPath) {
        backupAndRecoverService.dataBaseRecover(recoverPath);
    }
}
